package com.ziq.zcamp.bean.product

import com.blankj.utilcode.util.GsonUtils
import com.ziq.zcamp.bean.place.PlaceScoreInfo
import com.ziq.zcamp.bean.post.ImageInfo
import com.ziq.zcamp.proguard.ProguardKeep
import java.io.Serializable

class PlaceProduct : ProguardKeep, Serializable {

    companion object{
        const val STATUS_ON_SALE = 1
        const val STATUS_SELL_OUT = 2
        const val STATUS_TAKE_IT_OFF = 3
        const val STATUS_OVERDUE = 4
        const val STATUS_ILLEGAL_TO_DELETE = 5
        const val STATUS_WAIT_ON_SALE = 6 //待上架
    }


    var commodity_id : Long? = null //商品id
    var campid : Int? = null //营地id
    var name : String? = null //商品名称
    var title : String? = null //商品卖点
    var price : Int? = null //价格,单位：分
    var count : Int? = null //单日库存
    var all_count : Int? = null //总库存
    var goods_url : String? = null //商品图片
    var start_time : Long? = null
    var end_time : Long? = null
    var status : Int? = null //1销售中，2已售罄，3已下架，4已过期，5违规删除
    var is_refund : Int? = null //是否退款，0关闭退款，1开启退款
    var refund_rule : String? = null //退款规则



    //3。21。00营地列表使用到
    var url : List<ImageInfo>? = null //商品图片
    var content_detail : List<ProductIntroduceItem>? = null //商品详情
    var is_offline : Boolean? = null //是否下架
    var is_sell_out : Boolean? = null //是否售罄
    var price_range : List<Long>? = null //分时定价
    var distance : Long? = null //距离单位m
    //商品评价分数
    var score : PlaceScoreInfo?= null
    //3.17.00
    var is_identity : Int? = null //是否需要填身份证，0否1是
    var sales_volume : Int? = null //近30天销量



    var goods_url_list : List<ImageInfo>? = null //商品图片
    var refund_rule_list : List<RefundRule>? = null //退款规则

    fun parseData(){
        var imageList: List<ImageInfo> =  mutableListOf<ImageInfo>()
        if (goods_url?.isNotEmpty() == true){
            goods_url?.let {
                imageList = GsonUtils.fromJson(it, GsonUtils.getListType(
                    ImageInfo::class.java))
            }
        }
        goods_url_list = imageList
    }
}